package com.itheima.reggie.mapper;

import com.itheima.reggie.entity.Orders;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Service;

import java.util.List;

@Mapper
public interface OrdersMapper {
    @Insert("Insert into orders values(#{id} , #{number} , #{status} , #{userId} , #{addressBookId} , " +
            " #{orderTime} , #{checkoutTime} , #{payMethod} , #{amount} , #{remark} ," +
            " #{phone} , #{address} , #{username} , #{consignee} )")
    void save(Orders orders);


    //查询所有订单
    List<Orders> page(String number);

    //根据用户id来查询数据
    @Select(" select * from orders where user_id=#{user} ")
    List<Orders> findByUserId(Long user);

}
